00001
00002
00003
00004 #include "stdafx.h"
00005 #include "TraffEdu.h"
00006 #include "VehicleForm.h"
00007 #include "RoadForm.h"
00008 #include "SignForm.h"
00009 #include "LightForm.h"
00010 #include "EnvObjectsForm.h"
00011 #include ".\vehicleform.h"
00012 #include "Splitter.h"
00013 #include <fstream>
00014
00015 using namespace std;
00016
00017 ofstream vehiclefile("vehicle.txt");
00018
00019
00020 IMPLEMENT_DYNCREATE(VehicleForm, CFormView)
00021
00022 VehicleForm::VehicleForm()
00023 : CFormView(VehicleForm::IDD)
00024 {
00025 m_h_icon_vec_kamyonet = static_cast<HICON>(LoadImage (theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON35),
00026 IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR));
00027 m_h_icon_vec_semi = static_cast<HICON>(LoadImage (theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON34),
00028 IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR));
00029 }
00030
00031 VehicleForm::~VehicleForm()
00032 {
00033 }
00034
00035 void VehicleForm::DoDataExchange(CDataExchange* pDX)
00036 {
00037
00038 CFormView::DoDataExchange(pDX);
00039 DDX_Control(pDX, IDC_BUTTON8, vehicleButton1);
00040 DDX_Control(pDX, IDC_BUTTON9, vehicleButton2);
00041 }
00042
00043 BEGIN_MESSAGE_MAP(VehicleForm, CFormView)
00044 ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
00045 ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
00046 ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4)
00047 ON_BN_CLICKED(IDC_BUTTON8, OnBnClickedButton8)
00048 ON_BN_CLICKED(IDC_BUTTON9, OnBnClickedButton9)
00049 ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButton5)
00050 END_MESSAGE_MAP()
00051
00052
00053
00054
00055 #ifdef _DEBUG
00056 void VehicleForm::AssertValid() const
00057 {
00058 CFormView::AssertValid();
00059 }
00060
00061 void VehicleForm::Dump(CDumpContext& dc) const
00062 {
00063 CFormView::Dump(dc);
00064 }
00065 #endif //_DEBUG
00066
00067
00068
00069
00070 void VehicleForm::OnInitialUpdate()
00071 {
00072 CFormView::OnInitialUpdate();
00073 vehicleButton1.SetIcon (m_h_icon_vec_kamyonet);
00074 vehicleButton2.SetIcon (m_h_icon_vec_semi);
00075
00076 }
00077 void VehicleForm::OnBnClickedButton1()
00078 {
00079
00080 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00081 pParentSplitter->ReplaceView(RUNTIME_CLASS(RoadForm));
00082 }
00083
00084 void VehicleForm::OnBnClickedButton3()
00085 {
00086 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00087 pParentSplitter->ReplaceView(RUNTIME_CLASS(LightForm));
00088 }
00089
00090
00091 void VehicleForm::OnBnClickedButton4()
00092 {
00093 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00094 pParentSplitter->ReplaceView(RUNTIME_CLASS(SignForm));
00095 }
00096
00097 void VehicleForm::OnBnClickedButton5()
00098 {
00099 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00100 pParentSplitter->ReplaceView(RUNTIME_CLASS(EnvObjectsForm));
00101 }
00102
00103
00104 void VehicleForm::OnBnClickedButton8()
00105 {
00106 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00107
00108 CMainFrame *pFrame = reinterpret_cast<CMainFrame*>(pParentSplitter->GetParentFrame());
00109
00110 pFrame->drawMode = DRAW_VEHICLE_DODGE;
00111 }
00112
00113 void VehicleForm::OnBnClickedButton9()
00114 {
00115 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00116
00117 CMainFrame *pFrame = reinterpret_cast<CMainFrame*>(pParentSplitter->GetParentFrame());
00118
00119 pFrame->drawMode = DRAW_VEHICLE_SEMI;
00120 }
00121